package com.ry.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ry.mapper.ProductInventoryMapper;
import com.ry.model.ProductInventory;
import com.ry.service.ProductInventoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


@Slf4j
@Service
public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMapper, ProductInventory> implements ProductInventoryService {

    @Override
    public void updateInventoryById(ProductInventory productInventory) {
        this.updateById(productInventory);
        log.info("======更新mysql库存->productId:{},inventory:{}",productInventory.getProductId(),productInventory.getInventoryCnt());
    }

    @Override
    public ProductInventory queryInventoryById(Long productId) {
        log.info("======获取mysql库存->productId:{}",productId);
        return this.getById(productId);
    }

    @Override
    public void deleteInventoryById(Long productId) {
        this.removeById(productId);
        log.info("======删除mysql库存->productId:{}",productId);
    }
}
